/*indicate the usage of virtual, this key word means that this function
    should be replaced when the new class overridde this function*/
#include<iostream>
using namespace std;

class A
{
    public:
    virtual void f1()
    {cout<<"This is A.f1()\n"<<endl;}

    void f2()
    {cout<<"This is A.f2()\n"<<endl;}
};

class B: public A
{
    void f1()
    {cout<<"This is B.f1()\n"<<endl;}

    void f2()
    {cout<<"This is A.f2()\n"<<endl;}
};

int main()
{
    A *p=new B();
    p->f1();
    p->f2();
    return 0;
}
